package com.example.myfirstapp;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import com.example.location.LocationService;

public class MainActivity extends Activity {
	
	
	public final static String EXTRA_MESSAGE = "com.example.myfirstapp.MESSAGE";
	
	LocationService locationService;
    public TextView mLatLng;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		
		setContentView(R.layout.activity_main);		
	}
	
	protected void onStop() {
	    super.onStop();
	    locationService.locationManager.removeUpdates(locationService.locationListener);
	}
	
	protected void onStart() {
		mLatLng = (TextView) findViewById(R.id.latlng);	
		
		locationService = new LocationService(this);
	    if (!locationService.gpsEnabled) {
	        // Build an alert dialog here that requests that the user enable
	        // the location services, then when the user clicks the "OK" button,
	        // call enableLocationSettings()
	    }
		super.onStart();
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}
	
	/** Called when the user clicks the Send button */
	public void sendMessage(View view) {
	    // Do something in response to button
		//Intent intent = new Intent(this, DisplayMessageActivity.class);
		//EditText editText = (EditText) findViewById(R.id.edit_message);
		//String message = editText.getText().toString();
		//intent.putExtra(EXTRA_MESSAGE, message);
		//startActivity(intent);
	}
	
	

}
